<template>
    <div class="container">{{ user.username }}</div>
</template>
  
  <script lang="ts">
import { defineComponent, onMounted, ref } from 'vue'
import { getUser } from '../api'
export default defineComponent({
    setup() {
        const user = ref({username:''})
        onMounted(() => {
            const token = localStorage.getItem('token')
            console.log(token);
            getUser({ token }).then(res => {
                console.log(res);
                user.value = res.data.data
            })
        })
        return {
            user
        }
    }
})
</script>
  
  <style scoped lang="scss">
</style>
  